
layui.use(['jquery','layer','form'], function(){
    var $ = layui.jquery;
    var layer = layui.layer;
    var form = layui.form;


    form.on('submit(formDemo)', function(data){
        if (data){}
        var obj = {
            "pnumber":$("input[name=pnumber]").val(),
            "paymentamount": $("input[name=paymentamount]").val(),
            "paymentmethod":"支付宝",
            "operation":"线上缴费"
        }

        $.post("http://localhost:8012/propaidRefill/recharge",obj,function(data){
            var data2 = eval("("+data+")");
            if(data2.code == 200){
                layer.msg("充值成功！");
            }else{
                layer.msg("充值失败！用户号码不存在");
            }
        },'text')
        return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
    });









});